﻿using Xunit;

namespace AutoTest.Test
{
    public static class TestingExtensionMethods
    {
        public static void ShouldBeNull<T>(this T actual)
        {
            Assert.Null(actual);
        }

        public static T ShouldEqual<T>(this T actual, T expected)
        {
            Assert.Equal(expected, actual);
            return actual;
        }

        public static void ShouldBeFalse(this bool actual)
        {
            Assert.False(actual);
        } 

        public static T ShouldBeOfType<T>(this object actual) where T : class
        {
            Assert.IsAssignableFrom<T>(actual);
            return actual as T;
        }

        /// <summary>
        /// makes sure actual is not null
        /// </summary>
        /// <typeparam name="T">type of thang</typeparam>
        /// <param name="actual">thing to test</param>
        /// <returns>sent in object for fluent assertions</returns>
        public static T ShouldNotBeNull<T>(this T actual)
        {
            Assert.NotNull(actual);
            return actual;
        }
    }
}